# -*- mode: snippet -*-
# name: qmi
# key: qmi
# --
ll qmi(ll a, ll b, ll c) {
  ll res = 1 % c;
  while (b) {
    if (b & 1) res = res * a % c;
    a = a * a % c;
    b >>= 1;
  }
  return res;
}

